package com.ll.domain.user.convert;

import com.ll.app.api.req.WechatUserLoginDTO;
import com.ll.app.api.req.WechatUserRegisterReqDTO;
import com.ll.base.constant.LlConstants;
import com.ll.base.util.DateUtil;
import com.ll.base.util.ScalarUtil;
import com.ll.dal.po.UserPO;
import com.ll.domain.tenant.enums.AppEnum;
import com.ll.domain.tenant.enums.SystemOSEnum;
import com.ll.domain.user.dto.UserDTO;
import com.ll.domain.user.dto.UserLoginDTO;

import java.util.UUID;

public class UserLoginConvert {


    public static UserLoginDTO buildDingLoginDTO(UserDTO userDTO) {
        return UserLoginDTO.builder()
                .userDTO(userDTO)
                .app(AppEnum.阿里弓箭派)
                .os(SystemOSEnum.钉钉小程序)
                .uid(userDTO.getId())
                .otherUserId(userDTO.getDingTalkUserId())
                .build();
    }


    public static UserPO wechatUserRegisterDTO2UserPO(WechatUserRegisterReqDTO reqDTO) {
        UserPO userPO = new UserPO();
        userPO.setTenantId(reqDTO.getTenantId());
        userPO.setAppId((long) reqDTO.getApp().ordinal());
        userPO.setOtherSystems(SystemOSEnum.微信小程序.name());
        userPO.setOtherUserIds(reqDTO.getOtherUserId());
        userPO.setWechatUserId(reqDTO.getOtherUserId());
        userPO.setLogo(reqDTO.getLogo());
        userPO.setName(reqDTO.getUserName());
        userPO.setIntegral(ScalarUtil.DEFAULT_INTEGER_VALUE);
        return userPO;
    }

}
